import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import store from '@/store/index'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Login',
    component: Login,
    meta: { name: '登陆' ,path:'/'}
  },
  {
    path: '/home',
    name: 'Home',
    redirect: '/index',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '@/views/Home.vue'),
    children: [
      {
        path: '/index',
        name: 'Index',
        component: () => import(/* webpackChunkName: "about" */ '@/views/Index.vue'),
        meta: { name: '首页' ,path:'/index'}
      },
      {
        path: '/icon',
        name: 'Icon',
        component: () => import(/* webpackChunkName: "about" */ '@/views/Icon.vue'),
        meta: { name: 'cion',path:'/icon' }
      },
      {
        path: '/froms',
        name: 'Froms',
        component: () => import(/* webpackChunkName: "about" */ '@/views/Froms.vue'),
        meta: { name: '表单',path:'/froms' }
      },
      {
        path: '/upload',
        name: 'Upload',
        component: () => import(/* webpackChunkName: "about" */ '@/views/Upload.vue'),
        meta: { name: '上传图片',path:'/upload' }
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default router
